#ifndef _GLOBAL_TIMER_H_
#define _GLOBAL_TIMER_H_

#include <stdint.h>
#include <stdbool.h>
#include <taskManager.h>

#define SOFT_TIMER_INTERVAL      10ul /* ms */

/*- Types ------------------------------------------------------------------*/
typedef enum{
    TIMER_ONE_SHOT_MODE,
    TIMER_PERIODIC_MODE,
}SoftTimerMode_t;

typedef struct SoftTimer_t {
    /* Internal data */
    struct SoftTimer_t *next;
    uint32_t timeout;
    /* Timer parameters */
    uint32_t interval;
    SoftTimerMode_t mode;
    uint32_t param;
    void (*handler)(struct SoftTimer_t *timer);
}SoftTimer_t;

/*- Prototypes -------------------------------------------------------------*/
void SoftTimer_Start(SoftTimer_t *timer);
void SoftTimer_Stop(SoftTimer_t *timer);

bool SoftTimer_Started(SoftTimer_t *timer);
void SoftTimer_TaskHandler(void);
void SoftTimer_ExpireCallback(void);

























#endif